Delphi a excelovske grafy

Otázka od: simec

11. 11. 2003 20:48

Dobry den!

Potreboval by som poradit ohladom problemu tvorby grafu v exceli cez delphi.
Mam data ulozene v *.dbf tie dokazem nahrat do excelu ale uz neviem vytvorit
graf. Data su den a stav paliva. Mohli by ste mi prosim napisat ako na to.
Pripadne aj ukazku kodu.

Dakujem Marek




----------
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Zkontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 5 - stiahnite si pomocnika pre digitalnu fotografiu
(zme.zoner.sk)

Odpovedá: kexo

11. 11. 2003 23:48

sprav to najprv rucne v exceli, a nahravaj si to ako makro, potom ho len
'prepis' do delphi
kexo

----- Original Message -----
From: "simec" <simec@szm.sk>
Subject: Delphi a excelovske grafy


> Potreboval by som poradit ohladom problemu tvorby grafu v exceli cez
delphi. Mam data ulozene v *.dbf tie dokazem nahrat do excelu ale uz neviem
vytvorit graf. Data su den a stav paliva. Mohli by ste mi prosim napisat ako
na to. Pripadne aj





----------
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Zkontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 5 - stiahnite si pomocnika pre digitalnu fotografiu
(zme.zoner.sk)

Odpovedá: simec

12. 11. 2003 23:12

napisal som toto:

    Excel := CreateOleObject('Excel.Application');
    chart := Excel.charts.Add;
    chart.ChartType = xlXYScatterSmoothNoMarkers;
    chart.seriescollection.newseries;
    v:=vararraycreate([1,4],varvariant);
    w:=vararraycreate([1,4],varvariant);
    chart.seriescollection(1).values:=v;
    chart.seriescollection(1).xvalues:=w;
    excel.Visible := true;

stale nic. nemozete mi prosim niekto napisat funkcnu ukazku ako vytvorit
excelovsky graf cez delphi. Prosim.




----------
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Zkontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 5 - stiahnite si pomocnika pre digitalnu fotografiu
(zme.zoner.sk)

Odpovedá: Jaroslav Popluhar

12. 11. 2003 23:48

Hello kexo,

Tuesday, November 11, 2003, 11:46:04 PM, you wrote:

k> sprav to najprv rucne v exceli, a nahravaj si to ako makro, potom ho len
k> 'prepis' do delphi
k> kexo

Ak mas niekde naznak kodu 'prepis', mozes to poslat?

--
Best regards,
 Jaroslav mailto:delphi1@acc.sk





----------
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Zkontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 5 - stiahnite si pomocnika pre digitalnu fotografiu
(zme.zoner.sk)

Odpovedá: kexo

13. 11. 2003 13:30

sorry, som dost zaneprazdneny, takze len strucne par prikazov:

NAHRANE MAKRO:

    Range("A1").Select
    ActiveCell.FormulaR1C1 = "bunka1"
    Range("A1").Select
    With Selection.Font
        .Name = "Arial"
        .Size = 14
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    Columns("A:A").ColumnWidth = 4
    Range("A1:E5").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    Range("A1").Select
    ActiveWorkbook.SaveAs Filename:="D:\testsubor.xls",
FileFormat:=xlNormal, _
        Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
        CreateBackup:=False


DELPHI KOD:

    E := CreateOleObject('Excel.Application');
    E.DisplayAlerts:=false;
    E.WorkBooks.Add;
    E.ActiveSheet.Cells[1,1].Value:= 'bunka1';
    E.ActiveSheet.Cells[1,1].Font.Size:= 14;
    E.ActiveSheet.Columns[1].ColumnWidth := 4;
    E.ActiveSheet.Range['A1','E5'].Select;
    for i := 7 to 12 do
        E.Selection.Borders[i].Weight := 2;
    E.ActiveSheet.Cells[1,1].Select;
    E.ActiveWorkbook.SaveAs(nazov_suboru);
    if zobrazitExcel then
        E.Visible := True
    else
        E.Quit;


Ide hlavne o to, ze excelovske konstanty typu 'xlInsideHorizontal', 'xlThin'
treba nahradit ciselnymi hodnotami, a k prvkom typu rows, range, cells
pristupovat ako k prvkom N rozmerneho pola, a treba povyhadzovat defaultne
zbytocnosti, napr. 'LineStyle = xlContinuous'
v pripade zaujmu v dalsom pokracovani serialu ukazem postup ako na grafy  
kexo

----- Original Message -----
From: "Jaroslav Popluhar" <delphi1@acc.sk>
To: <delphi-l@clexpert.cz>
Sent: Wednesday, November 12, 2003 11:13 PM
Subject: Re: Delphi a excelovske grafy


> Hello kexo,
>
> Tuesday, November 11, 2003, 11:46:04 PM, you wrote:
>
> k> sprav to najprv rucne v exceli, a nahravaj si to ako makro, potom ho
len
> k> 'prepis' do delphi
> k> kexo
>
> Ak mas niekde naznak kodu 'prepis', mozes to poslat?
>
> --
> Best regards,
> Jaroslav mailto:delphi1@acc.sk
>
>





----------
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Zkontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 5 - stiahnite si pomocnika pre digitalnu fotografiu
(zme.zoner.sk)